<template>
	<div>
		<el-row :gutter="24">
			<el-col :span="1" style="margin-right:10px;">
				<p class="queryLabel">调拨状态:</p>
			</el-col>
			<el-col :span="4">
				<el-select size="small" v-model="condition.allocationStatus" placeholder="请选择调拨状态" clearable>
					<el-option v-for="item in saleType" :label="item.label" :value="item.value"></el-option>
				</el-select>
			</el-col>
			<el-col :span="1" style="margin-right:10px;">
				<p class="queryLabel">申请日期:</p>
			</el-col>
			<el-col :span="4">
				<el-date-picker v-model="data.firstStart" size="small" style="width:100%;" type="date" clearable placeholder="开始日期">
				</el-date-picker>
			</el-col>
			<el-col :span="1" style="margin-right:10px;">
				<p class="queryLabel">至:</p>
			</el-col>
			<el-col :span="4">
				<el-date-picker v-model="data.firstStarts" size="small" style="width:100%;" type="date" clearable placeholder="结束日期">
				</el-date-picker>
			</el-col>
		</el-row>
		<el-row :gutter="24">
			<el-col :span="1" style="margin-right:10px;">
				<p class="queryLabel">发出仓库:</p>
			</el-col>
			<el-col :span="4">
				<el-select size="small" v-model="condition.fromWarehouse" placeholder="请选择发出仓库" clearable>
					<el-option v-for="item in warehouseCombo" :label="item.label" :value="item.value"></el-option>
				</el-select>
			</el-col>
			<el-col :span="1" style="margin-right:5px;">
				<p class="queryLabel">接收仓库:</p>
			</el-col>
			<el-col :span="4">
				<el-select size="small" v-model="condition.aimWarehouse" placeholder="请选择接收仓库" clearable>
					<el-option v-for="item in warehouseCombo" :label="item.label" :value="item.value"></el-option>
				</el-select>
			</el-col>
			<el-col :span="5" style="padding-left: 0px;text-align: right">
				<el-button type="primary" size="small" v-on:click='companyQuery'>查 询</el-button>
			</el-col>
			<el-col :span="8" style="padding-left: 0px;text-align: right">
				<el-button type="primary" size="small" v-on:click='add'>新 增</el-button>
				<el-button type="primary" size="small" v-on:click='edit'>修 改</el-button>
				<el-button type="primary" size="small" v-on:click='savess'>提 交</el-button>
				<!--<el-button type="primary" size="small" v-on:click='showdialog'>打印</el-button>-->
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="24">
				<el-table :data="tableData.dataList" border style="width: 100%;align-content: center;" @selection-change="handleSelectionChanges">
					<el-table-column type="selection" width="55" label="选择">
					</el-table-column>
					<el-table-column label="发出仓库" prop="fromWarehouse" :formatter="fromWarehouseCov" width="130">
					</el-table-column>
					<el-table-column label="目标仓库" align="right" prop="aimWarehouse" :formatter="aimWarehouseCov" width="130">
					</el-table-column>
					<el-table-column label="调拨类型" align="right" prop="allocationType" :formatter="saleStatusCov" width="100">
					</el-table-column>
					<el-table-column label="调拨数量" align="right" prop="allocationNum" width="100">
					</el-table-column>
					<el-table-column label="申请人" align="right" prop="uName" width="100">
					</el-table-column>
					<el-table-column label="调拨原因" align="right" prop="allocationReason" width="100">
					</el-table-column>
					<el-table-column label="申请日期" align="right" prop="submitDate1">
					</el-table-column>
					<el-table-column label="审批状态" align="right" prop="currentApprovalStatus" width="100">
					</el-table-column>
					<el-table-column label="审批通过时间" align="right" prop="finishDate1">
					</el-table-column>
					<el-table-column label="操作" align="right" width="130">
						<template scope="scope">
							<el-button type="primary" size="mini" @click.native.prevent="infos(scope.$index)">审批详情</el-button>
							<el-button type="primary" size="mini" @click.native.prevent="info(scope.$index)">明细</el-button>
							<!--<el-button type="primary" v-if="scope.row.allocationStatus=='2'" size="mini" @click.native.prevent="info(scope.$index)">明细</el-button>-->
						</template>
					</el-table-column>
				</el-table>
				<el-pagination small @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="CurentPage" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout=" total,prev, pager, next" :total="tableData.total">
				</el-pagination>
			</el-col>
		</el-row>
		<el-dialog title="调拨单维护" v-model="comFormShow" size="large">
			<el-card class="box-card-f">
				<el-form :model="comFormData" ref="comForm" :rules="Rule" label-width="130px">
					<el-col :span="6">
						<el-form-item label="目标仓库：" prop="allocationOrder.aimWarehouse" required>
							<el-select size="small" v-model="comFormData.allocationOrder.aimWarehouse" placeholder="请选择目标仓库" clearable>
								<el-option v-for="item in warehouseCombo" :label="item.label" :value="item.value"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="6">
						<el-form-item label="调拨日期：" prop="allocationOrder.allocationDate" required>
							<el-date-picker @change="dateChange" v-model="comFormData.allocationOrder.allocationDate" size="small" style="width:100%;" type="date" clearable placeholder="调拨日期">
							</el-date-picker>
						</el-form-item>
					</el-col>
					<el-col :span="6">
						<el-form-item label="预计回库时间：" prop="allocationOrder.arriveWarehouseDate" required>
							<el-date-picker @change="dateChange" v-model="comFormData.allocationOrder.arriveWarehouseDate" size="small" style="width:100%;" type="date" clearable placeholder="回库日期">
							</el-date-picker>
						</el-form-item>
					</el-col>
					<el-col :span="6">
						<el-form-item label="流转天数：" prop="allocationOrder.arriveWarehouseDate" required>
							<el-input size="small" v-model="dayNum" readonly></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="6">
						<el-form-item label="调拨类型：" prop="allocationOrder.allocationType" required>
							<el-select size="small" v-model="comFormData.allocationOrder.allocationType" placeholder="请选择调拨类型" clearable>
								<el-option v-for="item in transferTypeCombo" :label="item.label" :value="item.value"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="6">
						<el-form-item label="融资方式：" prop="allocationOrder.rongzi" required>
							<el-input size="small" v-model="comFormData.allocationOrder.rongzi"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="6">
						<el-form-item label="交款金额：" prop="allocationOrder.payMoney">
							<el-input size="small" v-model="comFormData.allocationOrder.payMoney"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="6">
						<el-form-item label="交款时间：" prop="allocationOrder.payTime">
							<el-input size="small" v-model="comFormData.allocationOrder.payTime"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="6">
						<el-form-item label="存放车辆：" prop="allocationOrder.storeCar">
							<el-input size="small" v-model="comFormData.allocationOrder.storeCar"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="6">
						<el-form-item label="保证金金额：" prop="allocationOrder.depositMoney">
							<el-input size="small" v-model="comFormData.allocationOrder.depositMoney"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="6">
						<el-form-item label="保证金比例：" prop="allocationOrder.depositRatio">
							<el-input size="small" v-model="comFormData.allocationOrder.depositRatio"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="6">
						<el-form-item label="调拨原因：" prop="allocationOrder.allocationReason" required>
							<el-input size="small" type="textarea" :rows="2" v-model="comFormData.allocationOrder.allocationReason"></el-input>
						</el-form-item>
					</el-col>

				</el-form>
				<el-col :span="23" style="padding-left: 0px;text-align: right">
					<el-button type="primary" v-on:click='addCar'>添加车辆</el-button>
				</el-col>
			</el-card>
			<el-col :span="24">
				<el-table :data="comFormData.allocationOrderDetailList" border style="width: 100%;align-content: center;">
					<el-table-column prop="vin" label="VIN" width="180">
					</el-table-column>
					<el-table-column prop="carSeries" label="车系名称" width="150">
					</el-table-column>
					<el-table-column prop="carModel" label="车型名称" width="150">
					</el-table-column>
					<el-table-column prop="configure" label="配置名称" width="150">
					</el-table-column>
					<el-table-column prop="carModelYear" label="车型年" width="100">
					</el-table-column>
					<el-table-column prop="appearanceCode" label="外观代码" width="100">
					</el-table-column>
					<el-table-column prop="appearanceName" label="外观颜色" width="130">
					</el-table-column>
					<el-table-column prop="trimCode" label="内饰代码" width="130">
					</el-table-column>
					<el-table-column prop="trimName" label="内饰名称" width="150">
					</el-table-column>
					<el-table-column prop="chooseCode" label="加装代码" width="130">
					</el-table-column>
					<el-table-column prop="chooseName" label="加装名称" width="150">
					</el-table-column>
					<el-table-column label="操作" align="right" width="80">
						<template scope="scope">
							<el-button type="primary" size="mini" @click.native.prevent="removeCar(scope.$index)">移除</el-button>
						</template>
					</el-table-column>
				</el-table>
				<!--<el-pagination small @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="CurentPage" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout=" total,prev, pager, next" :total="tableData.total">
				</el-pagination>-->
			</el-col>
			<div slot="footer" class="dialog-footer">
				<el-button @click="comFormShow = false">取 消</el-button>
				<el-button type="primary" v-on:click='save("0")'>保 存</el-button>
				<el-button type="primary" v-if="pSave" v-on:click='saves("1")'>提 交</el-button>
			</div>
		</el-dialog>
		<el-dialog title="选择车辆" v-model="comFormShows" size="small">
			<el-row :gutter="24">
				<el-col :span="2">
					<p class="queryLabel">车系:</p>
				</el-col>
				<el-col :span="6">
					<el-input placeholder="请选择车系" size="small" icon="search" v-model="carModelCode" :on-icon-click="handleIconClick">
					</el-input>
				</el-col>
				<el-col :span="2">
					<p class="queryLabel">车辆型号:</p>
				</el-col>
				<el-col :span="6">
					<el-select size="small" style="width: 100%;" v-model="conditionCar.carModelCode" placeholder="请选择型号" clearable @change="changeModel">
						<el-option v-for="item in modelCombo" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-col>
				<el-col :span="2">
					<p class="queryLabel">车辆配置:</p>
				</el-col>
				<el-col :span="6">
					<el-select size="small" style="width: 100%;" v-model="conditionCar.carConfigureCode" placeholder="请选择配置" clearable>
						<el-option v-for="item in configCombo" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-col>
			</el-row>
			<el-row :gutter="24">
				<el-col :span="2" style="">
					<p class="queryLabel">仓库:</p>
				</el-col>
				<el-col :span="6" style="margin-left: -5px;">
					<el-select size="small" v-model="conditionCar.warehouse" placeholder="请选择仓库" clearable>
						<el-option v-for="item in warehouseType" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-col>
				<el-col :span="2" style="">
					<p class="queryLabel">VIN:</p>
				</el-col>
				<el-col :span="6">
					<el-input placeholder="请输入VIN" style="margin-left: 10px;" size="small" v-model="conditionCar.vin">
					</el-input>
				</el-col>
				<el-col :span="8" style="padding-left: 0px;text-align: right">
					<el-button type="primary" size="small" v-on:click='carQuery'>查询</el-button>
					<el-button type="primary" size="small" v-on:click='clean'>重置查询条件</el-button>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="24">
					<el-table :data="tableDataCars.dataList" border style="width: 100%;align-content: center;" @selection-change="handleSelectionChange">
						<el-table-column type="selection" width="60">
						</el-table-column>
						<el-table-column prop="vin" label="VIN" width="180">
						</el-table-column>
						<el-table-column prop="carSeries" label="车系名称" width="150">
						</el-table-column>
						<el-table-column prop="carModel" label="车型名称" width="150">
						</el-table-column>
						<el-table-column prop="configure" label="配置名称" width="150">
						</el-table-column>
						<el-table-column prop="carModelYear" label="车型年" width="100">
						</el-table-column>
						<el-table-column prop="appearanceCode" label="外观代码" width="100">
						</el-table-column>
						<el-table-column prop="appearanceName" label="外观颜色" width="130">
						</el-table-column>
						<el-table-column prop="trimCode" label="内饰代码" width="130">
						</el-table-column>
						<el-table-column prop="trimName" label="内饰名称" width="150">
						</el-table-column>
						<el-table-column prop="chooseCode" label="加装代码" width="100">
						</el-table-column>
						<el-table-column prop="chooseName" label="加装名称" width="150">
						</el-table-column>
					</el-table>
					<!--<el-pagination small @size-change="handleSizeChangeCar" @current-change="handleCurrentChangeCar" :current-page="CurentPageCar" :page-size="pageCar.pageSize" layout=" total,prev, pager, next" :total="tableDataCar.total">
					</el-pagination>-->
				</el-col>
			</el-row>
			<div slot="footer" class="dialog-footer">
				<el-button @click="comFormShows = false">取 消</el-button>
				<el-button type="primary" v-on:click='saveAdd'>提 交</el-button>
			</div>
		</el-dialog>
		<el-dialog title="打印出库单" v-model="editComFormShow" size="large">
			<el-col :span="24" style="padding-left: 0px;text-align: right">
				<!--<el-button type="primary" v-if="prientShow" size="small" v-on:click='printOutBillButton'>打印出库单</el-button>-->
			</el-col>
			<el-col :span="24">
				<el-table :data="comFormData.allocationOrderDetailList" border style="width: 100%;align-content: center;" @selection-change="infoChenck">
					<el-table-column type="selection" width="60">
					</el-table-column>
					<el-table-column prop="vin" label="VIN" width="180">
					</el-table-column>
					<el-table-column prop="carSeries" label="车系名称" width="150">
					</el-table-column>
					<el-table-column prop="carModel" label="车型名称" width="150">
					</el-table-column>
					<el-table-column prop="configure" label="配置名称" width="150">
					</el-table-column>
					<el-table-column prop="carModelYear" label="车型年" width="150">
					</el-table-column>
					<el-table-column prop="appearanceCode" label="外观代码" width="150">
					</el-table-column>
					<el-table-column prop="appearanceName" label="外观颜色" width="150">
					</el-table-column>
					<el-table-column prop="trimCode" label="内饰代码" width="150">
					</el-table-column>
					<el-table-column prop="trimName" label="内饰名称" width="150">
					</el-table-column>
					<el-table-column prop="chooseCode" label="加装代码" width="150">
					</el-table-column>
					<el-table-column prop="chooseName" label="加装名称" width="150">
					</el-table-column>
					<!--<el-table-column label="操作" align="right" width="80">
						<template scope="scope">
							<el-button type="primary" size="mini" @click.native.prevent="removeCar(scope.$index)">移除</el-button>
						</template>
					</el-table-column>-->
				</el-table>
				<!--<el-pagination small @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="CurentPage" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout=" total,prev, pager, next" :total="tableData.total">
				</el-pagination>-->
			</el-col>
		</el-dialog>
		<el-dialog title="审批详情" v-model="editComFormShowL" size="tiny">
			<el-table :data="sList" border style="width: 100%;align-content: center;">
				<el-table-column prop="approvalers" label="审批人" width="100">
				</el-table-column>
				<el-table-column prop="approvalDate" label="审批时间" width="100">
				</el-table-column>
				<el-table-column prop="approvalStatus" label="审批状态" width="100" :formatter="redstats">
				</el-table-column>
				<el-table-column prop="approvalOpinion" label="审批意见">
				</el-table-column>
			</el-table>
		</el-dialog>
		<el-dialog tittl="打印" v-model="dayinFormShow" id="dvData" size="large">
			<div id="printHtml" style=" width: 100%;">
				<el-row>
					<div id="" style="margin-left: 35%; width: 65%;">
						<font face="宋体">
							<div style="border-collapse:collapse;font-size: 20px;margin:0 auto;color:#000000">
								调拨单
							</div>
						</font>
					</div>
					<div id="" style="margin-left: 40%; width: 100%; float: left;);">
						<pre>   发出单位: {{comFormData.allocationOrder.fromWarehouse}}           申请人:  {{comFormData.allocationOrder.uName}}         调拨类型:  {{comFormData.allocationOrder.allocationType}}            收货单位:{{this.$data.comFormData.allocationOrder.aimWarehouse }}
   发出时间:{{comFormData.allocationOrder.allocationDate}}           调拨原因: {{comFormData.allocationOrder.allocationReason}}              预计回库时间:{{comFormData.allocationOrder.arriveWarehouseDate}}
						</pre>
					</div>
					<div>
						<table width="100%" border="1" style="border-collapse:collapse;font-size: 1px!important;margin:0 auto;color:#1F2D3D;text-align: center;">
							<tr>
								<td>VIN</td>
								<td>车系名称</td>
								<td>车型名称</td>
								<td>配置名称 </td>
								<td>车型年 </td>
								<td>外观代码 </td>
								<td>外观颜色 </td>
								<td>内饰代码 </td>
								<td>内饰名称</td>
								<td>加装代码</td>
								<td>加装名称</td>
							</tr>
							<tr v-for="list in dyList">
								<td>{{list.vin}} </td>
								<td>{{list.carSeries}}</td>
								<td> {{list.carModel}} </td>
								<td> {{list.configure}} </td>
								<td> {{list.carModelYear}} </td>
								<td> {{list.appearanceCode}} </td>
								<td> {{list.appearanceName}} </td>
								<td> {{list.trimCode}} </td>
								<td> {{list.trimName}} </td>
								<td> {{list.chooseCode}} </td>
								<td>{{list.chooseName}} </td>
							</tr>
						</table>

					</div>

				</el-row>
			</div>
			<!--底部的注意 结束-->
			<el-row style="margin-left:5px">
				<el-col>
					<el-button type="primary" @click="saveDayin">点击打印</el-button>
				</el-col>
			</el-row>
		</el-dialog>

		<!--------------------调拨出库单打印预览--------------------->
		<el-dialog tittl="打印" v-model="printOutBillDialog" id="dvData" size="large">
			<div id="printHtml_outBill" style=" width: 100%;">
				<div id="datafor" v-for="(pList,index) in printList">
					<font face="宋体">
						<el-row>
							<div id="" style="margin-left: 35%; width: 65%;">
								<font face="宋体">
									<div style="border-collapse:collapse;font-size: 30px;margin:0 auto;color:#000000">
										调拨出库单
										<div style="border-collapse:collapse;font-size: 20px;margin:0 auto;color:#000000;margin-left: 25%;"></div>
									</div>
								</font>
							</div>
						</el-row>
						<div>
							<table>
								<tr>
									<td width="1%">
										○请在此打孔装订○
									</td>
									<td width="97%">
										<table width="80%" border="1px solid #000000" cellspacing="0px" cellpadding="10px" bgcolor="#FFFFFF" style="border-collapse:collapse;font-size: 10px;margin:0 auto;color:#1F2D3D">
											<tr>
												<td width="25%" colspan="3"><b>车型:</b> {{pList.carModel}}</td>
												<td width="25%" colspan="2"><b>颜色:</b> {{pList.appearanceCode}}</td>
												<td width="25%" colspan="2"><b>车架号码(后八位): {{pList.vin.substring(9,17)}}</b></td>
												<td width="25%" colspan="2"><b>发票号</b></td>
											</tr>
											<tr>
												<td rowspan="1" colspan="1" width="12%"><b>销售部分填写</b></td>
												<td colspan="8">
													<!--字段未对应-->
													<pre>发出单位: {{$data.OOutWhere}}		申请人:  {{$data.orderList.uName}}		调拨类型:  {{$data.OallocationType}}		收货单位:{{$data.OrecieveWhere}}
													   <br/>发出时间:{{$data.orderList.allocationDate }}		调拨原因: {{$data.orderList.allocationReason}}		预计回库时间:{{$data.orderList.estimateBackDate}} <!--预计回库时间-->
												</pre>
												</td>
											</tr>
											<tr>
												<td colspan="9">
													<div style="float:left;width: 300px;"><b>提车人:</b></div>
													<div style="float:left;width: 50px;"><b>年</b></div>
													<div style="float:left;width: 50px;"><b>月</b></div>
													<div style="float:left;width: 50px;"><b>日</b></div>
												</td>
											</tr>
											<tr v-for="list in sList">
												<td colspan="9">
													<div style="width: 30%;float:left"><b>审批人：</b>{{list.approvalers}}</div>
													<div style="width: 30%;float:left"><b>审批意见:</b>{{list.approvalOpinion}}</div>
													<div style="width: 30%;float:left"><b>审批日期:</b>{{list.approvalDate}}</div>
													<!--<div style="width: 30%;display:inline"><b>审批人：</b>{{list.approvalers}}</div>
													<div style="width: 30%;display:inline"><b>审批意见:</b>{{list.approvalOpinion}}</div>
													<div style="width: 30%;display:inline"><b>审批日期:</b>{{list.approvalDate}}</div>-->
												</td>
											</tr>
											<tr>
												<td colspan="9" rowspan="3" height="100px"><b>备注：</b></td>

											</tr>
										</table>
									</td>
									<td valign="middle">
										<div style="font-size:12px!important;height: 300px; width: 12px;">
											请按照背面注意事项认真填写，涂改或复印无效
										</div>
									</td>

								</tr>
							</table>
						</div>
						<el-row>
							<div id="" style=" float: left;padding: 10px;">
								注意事项:<br> 1:出库单一式两联,销售部门掌握车辆出库单本票，签发出库单
								<br> 2:出库单必须保持序号连续，不能跳号，涂改，序号的缺失视作违规
								<br> 3:出库单涂改则注明“作废”，并保留“作废件”，并且在下一张顺次序号的出库单上重新填写
								<br> 4:每月下班后，库管将出库单原件（包括作废件）全部按编号次序归档
								<br>
							</div>
						</el-row>
					</font>
					<div v-if="(index+1)%2==0">
						<br><br><br><br><br><br><br><br><br><br><br><br><br>
					</div>
				</div>
			</div>
			<!--底部的注意 结束-->
			<el-row style="margin-left:5px">
				<el-col>
					<el-button type="primary" @click="saveDayins">点击打印</el-button>
				</el-col>
			</el-row>
		</el-dialog>
		<carserice :show="showStart" v-if="showStart" v-on:close="showStart=false" v-on:insert="insert"></carserice>
	</div>
</template>
<script>
	import carserice from '../../insPlugins/carSeries.vue'
	import moment from 'moment'
	export default {
		components: {
			carserice
		},
		data: function() {
			return {
				//明细调拨状态
				statsInfo: "",
				//调拨单ID
				sele: {
					allocationId: "",
				},
				//打印次数向后台传递的数组
				printNum: {
					ids: [],
				},
				sList: [],
				//出库单预览界面调拨类型格式化
				OallocationType: "",
				//发出单位格式化
				OOutWhere: "",
				//收货单位格式化
				OrecieveWhere: "",

				//调拨出库单打印预览弹窗
				printOutBillDialog: false,
				//待打印列表
				printList: [],
				//是否显示打印按钮
				prientShow: false,
				//打印窗口
				dayindayin: false,
				dayinFormShow: false,
				//仓库下拉
				warehouseType: [],
				dyList: [],
				//调拨类型
				transferTypeCombo: [],
				//显示明细
				editComFormShow: false,
				//仓库下拉
				warehouseCombo: [],
				//参数
				saleType: [{
					label: '已创建',
					value: '0'
				}, {
					label: '已提交',
					value: '1'
				}, {
					label: '已审核',
					value: '2'
				}],
				//修改金额的form
				comFormDataPrice: {
					id: "",
					price: ""
				},
				//日期查询条件
				data: {
					firstStart: "",
					firstStarts: ""
				},
				insuranceCombo: [{
					label: '交强险',
					value: '0'
				}, {
					label: '商业险',
					value: '1'
				}],
				commissionCombo: [{
					label: '常规佣金',
					value: '0'
				}, {
					label: '促销佣金',
					value: '1'
				}],
				//页码数
				CurentPage: 1,
				//每页的数量
				page: this.page,
				editComFormShowL: false,
				privateList: [],
				//页码数
				CurentPageCar: 1,
				//每页的数量
				pageCar: this.page,
				//已经选择的车辆
				tableDataCar: {
					total: 0,
					dataList: []
				},
				//未选择的车辆
				tableDataCars: {
					total: 0,
					dataList: []
				},
				//公司数据
				tableData: {
					total: 0,
					dataList: []
				},
				pSave: false,
				//佣金数据
				//分组数据
				tableDatas: {
					total: 0,
					dataList: []
				},
				activeName: 'first',
				companyName: '',
				conditions: {
					invoiceStratDate: "",
					invoiceStopDate: "",
					inputName: ""
				},
				condition: {
					allocationStatus: "",
					applicationStartDate: "",
					applicationStopDate: "",
					fromWarehouse: "",
					aimWarehouse: "",
				},
				conditionCar: {
					vin: "", //、
					brand: "", //品牌、
					oldNum: "", //提单号、
					carModel: "", //车型
					enterWarehouseNum: "",
					warehouse: "",
					status: "1",
					sInvoice: "1", //区别发票登记选车和调拨选车
					carSeriesCode: "", //车系
					carModelCode: "", //车型
					carConfigureCode: "", //配置
				},
				conditionCars: {
					vin: "", //、
					brand: "", //品牌、
					oldNum: "", //提单号、
					carModel: "", //车型
					enterWarehouseNum: "",
					warehouse: "",
					status: "1",
					sInvoice: "1", //区别发票登记选车和调拨选车
					carSeriesCode: "", //车系
					carModelCode: "", //车型
					carConfigureCode: "", //配置
				},
				dayNum: "0",
				uName: '',
				submitDate: "",
				finishDate: "",
				comFormShow: false,
				comFormShows: false,
				//校验规则
				Rule: {
					insuranceCompanyName: [{
						required: true,
						message: '请输入公司名称',
						trigger: 'blur'
					}],
					insuranceCompanyCode: [{
						required: true,
						message: '请输入公司简称',
						trigger: 'blur'
					}]
				},
				//仓库转换
				levelConvertData: {},
				//校验规则
				Rules: {},

				comFormData: {
					allocationOrder: {
						detailId: "",
						id: "",
						fromWarehouse: "", //  发出仓库
						aimWarehouse: "", //  接收仓库
						allocationType: "", //  调拨类型
						allocationDate: "", //  调拨时间
						allocationReason: "", //调拨原因
						arriveWarehouseDate: "", //预计回库时间
						allocationNum: "", //调拨数量
						uName: "", //调拨申请人
						createUser: "", //创建人
						createTime: "", //创建时间
						rongzi: "",
						payMoney: "", //交款金额
						payTime: "", //交款时间
						storeCar: "", //存放车辆
						depositMoney: "", //保证金金额
						depositRatio: "", //保证金比例
						//submitDate:"",
						//finishDate:"",
					},
					allocationOrderDetailList: [],
				},
				emptyData: {
					allocationOrder: {
						detailId: "",
						id: "",
						fromWarehouse: "", //  发出仓库
						aimWarehouse: "", //  接收仓库
						allocationType: "", //  调拨类型
						allocationDate: "", //  调拨时间
						allocationReason: "", //调拨原因
						arriveWarehouseDate: "", //预计回库时间
						allocationNum: "", //调拨数量
						uName: "", //调拨申请人
						createUser: "", //创建人
						createTime: "", //创建时间
						rongzi: "",
						payMoney: "", //交款金额
						payTime: "", //交款时间
						storeCar: "", //存放车辆
						depositMoney: "", //保证金金额
						depositRatio: "", //保证金比例
						//submitDate:"",
						//finishDate:"",
					},
					allocationOrderDetailList: [],
				},
				comFormDatas: {
					companyId: "",
					createTime: "",
					updateUser: "",
					createUser: "",
					update: "",
					commission: "",
					id: "",
					insuranceType: "",
					commissionType: "",
					startDate: "",
					stopDate: "",
					insuranceCompanyName: ""
				},
				emptyDatas: {
					companyId: "",
					createTime: "",
					updateUser: "",
					createUser: "",
					update: "",
					commission: "",
					id: "",
					insuranceType: "",
					commissionType: "",
					startDate: "",
					stopDate: "",
					insuranceCompanyName: ""
				},
				//车辆的选中
				multipleSelection: [],
				//调拨到单的选中
				multipleSelections: [],
				companyId: "",
				//调拨金额显示框
				editFormShow: false,
				infoId: "",
				infoChenckData: [],
				infoData: "",
				//生成出库单需要的实体
				prientData: {
					vin: [],
					outType: "", //出库类型
					estimateBackDate: "", //预计回库时间
					relationOrderNum: "", //调拨单id
				},
				//选中的调拨单
				orderList: {},
				//车系选择窗
				showStart: false,
				//车型代码 
				carModelCode: "",
				//配置的下拉
				configCombo: [],
				//车型的下拉
				modelCombo: [],
				//调拨类型转换
				tranTypeConvertData:{},
			}
		},
		methods: {
			//车系选择的回调
			insert: function(val, lable) {
				debugger;
				this.$data.conditionCar.carSeriesCode = val;
				this.$data.carModelCode = lable;
				this.$http.get(this.API_ROOT + '/base/carModel/combo', {
					params: {
						seriesId: val
					}
				}).then((response) => {
					debugger;
					this.$data.modelCombo = response.data;
					this.$data.conditionCar.carModelCode = "";
					this.$data.conditionCar.carConfigureCode = "";
					//this.$message(response.data);
				}, (response) => {});
			},
			//车型改变的回调
			changeModel: function(val) {
				if(val != "") {
					this.comboConfigure(val);
				}
				debugger;
			},
			//选择车型后的回调
			comboConfigure: function(val) {
				this.$http.get(this.API_ROOT + '/base/carConfigure/combo', {
					params: {
						modelId: val
					}
				}).then((response) => {
					debugger;
					this.$data.configCombo = response.data;
					this.$data.conditionCar.carConfigureCode = "";
					//this.$message(response.data);
				}, (response) => {});
			},
			//打开车型车系选择
			handleIconClick: function() {
				this.$data.showStart = true;
			},
			dateChange: function(val) {

				this.$data.dayNum = this.DateDiff(this.$data.comFormData.allocationOrder.allocationDate, this.$data.comFormData.allocationOrder.arriveWarehouseDate)
				debugger;
			},
			//计算时间差
			DateDiff: function(startDates, endDates) { //sDate1和sDate2是2002-12-18格式

				if(startDates != "" && endDates != "") {

					var aDate, oDate1, oDate2, iDays, sDate1, sDate2
					sDate1 = this.momentFu(startDates);
					sDate2 = this.momentFu(endDates);
					//var  aDate,  oDate1,  oDate2,  iDays  
					aDate = sDate1.split("-")
					oDate1 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0]) //转换为12-18-2002格式  
					aDate = sDate2.split("-")
					oDate2 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0])
					var tp = oDate1 - oDate2;

					if(tp > 0) {
						iDays = 0
						return iDays;
						this.$message.error("时间有误，请重新填写！");
					} else {
						iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 / 24) //把相差的毫秒数转换为天数  
						return iDays;
					}

				} else {
					iDays = 0
					return iDays;
				}
			},
			//提交
			saves: function() {
				this.$http.get(this.API_ROOT + '/scm/allocationOrder/submitOrPass', {
					params: {
						pid: this.$data.comFormData.allocationOrder.allocationType, //审批类型
						id: this.$data.comFormData.allocationOrder.id //单据id
					}
				}).then(resp => {
					if(resp.data.success) {
						debugger;
						this.companyQuery();
						this.$data.comFormShow = false;
						this.$message(resp.data.msg);
					} else {
						this.$message.error(resp.data.msg);
					}
				}, resp => {});
			},
			//提交
			savess: function() {
				if(this.$data.multipleSelections.length == 1) {
					debugger;
					if(this.$data.multipleSelections[0].fromWarehouse == "" ||
						this.$data.multipleSelections[0].fromWarehouse == null ||
						this.$data.multipleSelections[0].aimWarehouse == "" ||
						this.$data.multipleSelections[0].allocationNum == "" ||
						this.$data.multipleSelections[0].aimWarehouse == null ||
						this.$data.multipleSelections[0].allocationNum == null) {
						this.$message.error("调拨单信息不完整，请先维护！")
					} else {
						this.$http.get(this.API_ROOT + '/scm/allocationOrder/submitOrPass', {
							params: {
								pid: this.$data.multipleSelections[0].allocationType, //审批类型
								id: this.$data.multipleSelections[0].id //单据id
							}
						}).then(resp => {
							if(resp.data.success) {
								debugger;
								this.companyQuery();
								this.$data.comFormShow = false;
								this.$message(resp.data.msg);
							} else {
								this.$message.error(resp.data.msg);
							}
						}, resp => {});
					};
				} else {
					this.$message.error("请选择一条数据！");
				}

			},
			saveDayins: function() {

				var ids = [];
				//printNum.ids.push(this.$data.infoChenckData.id);
				for(var i = 0; i < this.$data.infoChenckData.length; i++) {
					ids[i] = this.$data.infoChenckData[i].id;
				}

				this.$http.post(this.API_ROOT + '/scm/allocationOrder/addTime', ids, {
					params: {}
				}).then(resp => {
					if(resp.data.success) {
						debugger;
						//this.$data.sList = resp.data.dataList;
						//this.prientOrder();
					} else {}
				}, resp => {})

				debugger;
				var outstr = document.getElementById("printHtml_outBill").innerHTML;
				//var br  = "<br>ddd";
				var printWindow = window.open();
				printWindow.document.body.innerHTML = outstr;
				printWindow.print();
				printWindow.close();

				this.$data.editComFormShow = false; // 二层dialog 隐藏
				this.$data.printOutBillDialog = false; // 顶层dialog 隐藏
			},
			//打印
			saveDayin: function() {

				debugger;
				var outstr = document.getElementById("printHtml").innerHTML;
				var printWindow = window.open();
				printWindow.document.body.innerHTML = outstr;
				printWindow.print();
				printWindow.close();
				this.$data.dayinFormShow = false;
				//this.$data.editComFormShow = false;
			},
			//状态转换
			statusCov: function(row, column) {
				var temp = '';
				switch(row.allocationStatus) {
					case '0':
						temp = "已保存";
						break;
					case '1':
						temp = '已提交';
						break;
					case "2":
						temp = '已审核';
						break;
					default:
						''
						break
				};
				return temp;
			},
			//打印勾选
			infoChenck: function(val) {
				debugger;
				this.$data.infoChenckData = val;
			},

			//打印出库单按钮
			printOutBillButton: function() {
				//this.$data.infoChenckData	// 打印勾选值
				if(this.$data.infoChenckData.length <= 0) {
					this.$message.error("至少选择一条数据");
				} else {
					this.$http.post(this.API_ROOT + '/scm/approvalflowDetail/page', this.$data.sele, {
						params: {}
					}).then(resp => {
						if(resp.data.success) {
							debugger;
							this.$data.sList = resp.data.dataList;
							this.prientOrder();
						} else {}
					}, resp => {})
					debugger;
					//获取已选择的数据
					this.$data.printList = this.$data.infoChenckData;
					//显示打印预览弹窗

				}
				debugger;
			},
			showdialog: function() {
				debugger;
				if(this.$data.multipleSelections.length == 1 && this.$data.multipleSelections[0].currentApprovalStatus == "结束") {
					this.$data.comFormData.allocationOrder.id = this.$data.multipleSelections[0].id;
					//this.$data.comFormData.allocationOrder.fromWarehouse = this.$data.multipleSelections[0].fromWarehouse;
					//					this.$data.comFormData.allocationOrder.aimWarehouse = this.$data.multipleSelections[0].aimWarehouse;
					//					this.$data.comFormData.allocationOrder.allocationType = this.$data.multipleSelections[0].allocationType;
					this.$data.comFormData.allocationOrder.uName = this.$data.multipleSelections[0].uName;
					this.$data.comFormData.allocationOrder.allocationDate = this.$data.multipleSelections[0].allocationDate;
					this.$data.comFormData.allocationOrder.allocationReason = this.$data.multipleSelections[0].allocationReason;
					this.$data.comFormData.allocationOrder.arriveWarehouseDate = this.$data.multipleSelections[0].estimateBackDate;
					debugger;
					this.$data.comFormData.allocationOrder.fromWarehouse = this.fromWarehouseCov(this.$data.multipleSelections[0]);
					this.$data.comFormData.allocationOrder.allocationType = this.saleStatusCov(this.$data.multipleSelections[0]);
					this.$data.comFormData.allocationOrder.aimWarehouse = this.aimWarehouseCov(this.$data.multipleSelections[0]);
					this.$http.get(this.API_ROOT + '/scm/allocationOrder/carList', {
						params: {
							id: this.$data.multipleSelections[0].id
						}
					}).then(resp => {
						debugger;
						this.$data.comFormData.allocationOrderDetailList = resp.data.data;
						this.$data.dyList = resp.data.data;
					}, resp => {});
					this.$data.dayinFormShow = true;
				} else {
					this.$message.error("请选择一条审批通过的数据");
				}
			},
			//打印出库单
			prientOrder: function() {
				debugger;
				if(this.$data.infoChenckData.length < 1) {
					this.$message.error("请至少选择一条数据");
				} else {
					for(var i = 0; i < this.$data.infoChenckData.length; i++) {
						this.$data.prientData.vin.push(this.$data.infoChenckData[i].vin);
					}
					debugger;
					//生成出库单的接口
					//var s = this.$data.prientData.vin[0];
					//this.$data.prientData.vin = this.$data.infoChenckData[0].vin;
					//调拨类型
					this.$data.prientData.outType = this.$data.orderList.allocationType;
					//预计回库时间
					this.$data.prientData.estimateBackDate = this.$data.orderList.estimateBackDate;
					//调拨单id
					this.$data.prientData.relationOrderNum = this.$data.orderList.id;
					//this.$data.prientData.relationOrderNum = =this.$data.orderList.id;
					this.$http.post(this.API_ROOT + '/scm/out/saveRequisition', this.$data.prientData, {
						params: {
							type: 1
						}
					}).then(resp => {
						this.$data.printOutBillDialog = true;
						if(resp.data.success) {
							debugger;
							this.$message(resp.data.msg);
							this.$data.editComFormShow = false;

							//this.query();
						} else {
							this.$message.error(resp.data.msg);
						}
					}, resp => {})
				}
			},
			//保存新增的车辆
			saveAdd: function() {
				debugger;
				for(var i = 0; i < this.$data.multipleSelection.length; i++) {
					//第一辆车
					if(i == 0) {
						var flog = true;
						for(var j = 0; j < this.$data.comFormData.allocationOrderDetailList.length; j++) {
							if(this.$data.comFormData.allocationOrderDetailList[j].vin == this.$data.multipleSelection[i].vin) {
								flog = false;
							}
						}
						if(flog == true) {
							this.$data.comFormData.allocationOrderDetailList.push(this.$data.multipleSelection[i]);
							this.$data.comFormData.allocationOrder.fromWarehouse = this.$data.comFormData.allocationOrderDetailList[0].warehouseId;
						}
						//非第一辆车
					} else {
						if(this.$data.comFormData.allocationOrder.fromWarehouse != this.$data.multipleSelection[i].warehouseId) {} else {
							var flog = true;
							for(var j = 0; j < this.$data.comFormData.allocationOrderDetailList.length; j++) {
								if(this.$data.comFormData.allocationOrderDetailList[j].vin == this.$data.multipleSelection[i].vin) {
									flog = false;
								}
							}
							if(flog == true) {
								this.$data.comFormData.allocationOrderDetailList.push(this.$data.multipleSelection[i]);
							}
						}
					}
				}
				this.$data.comFormShows = false;
			},
			//	金额
			esitPrice: function(index) {
				debugger;
				this.$data.comFormDataPrice.id = this.$data.comFormData.allocationOrderDetailList[index].id;
				this.$data.comFormDataPrice.price = this.$data.comFormData.allocationOrderDetailList[index].carPrice;
				this.$data.editFormShow = true;
			},
			//移除车辆
			removeCar: function(index) {
				this.$data.comFormData.allocationOrderDetailList.splice(index, 1);
			},
			//选择框
			handleSelectionChange: function(val) {
				debugger;
				this.$data.multipleSelection = val;
			},
			//选择框
			handleSelectionChanges: function(val) {
				debugger;
				this.$data.multipleSelections = val;
			},
			//切换tab页
			handleClick: function(tab, event) {
				console.log(tab, event);
			},
			add: function() {
				debugger;
				this.$data.comFormData.allocationOrder = Object.assign(this.$data.comFormData.allocationOrder, this.$data.emptyData.allocationOrder);
				this.$data.comFormData.allocationOrderDetailList = [];
				this.$data.comFormShow = true;
			},
			edit: function() {
				this.$data.pSave = true;
				debugger;
				if(this.$data.multipleSelections.length == 1 && this.$data.multipleSelections[0].currentApprovalStatus == null) {
					this.$data.comFormData.allocationOrder.id = this.$data.multipleSelections[0].id;
					this.$data.comFormData.allocationOrder.fromWarehouse = this.$data.multipleSelections[0].fromWarehouse;
					this.$data.comFormData.allocationOrder.aimWarehouse = this.$data.multipleSelections[0].aimWarehouse;
					this.$data.comFormData.allocationOrder.allocationType = this.$data.multipleSelections[0].allocationType;
					this.$data.comFormData.allocationOrder.allocationDate = this.$data.multipleSelections[0].allocationDate;
					this.$data.comFormData.allocationOrder.allocationReason = this.$data.multipleSelections[0].allocationReason;
					this.$data.comFormData.allocationOrder.arriveWarehouseDate = this.$data.multipleSelections[0].estimateBackDate;
					this.$data.comFormData.allocationOrder.createTime = this.$data.multipleSelections[0].createTime;
					this.$data.comFormData.allocationOrder.createUser = this.$data.multipleSelections[0].createUser;
					
					
					this.$data.comFormData.allocationOrder.payMoney = this.$data.multipleSelections[0].payMoney;
					this.$data.comFormData.allocationOrder.payTime = this.$data.multipleSelections[0].payTime;
					this.$data.comFormData.allocationOrder.storeCar = this.$data.multipleSelections[0].storeCar;
					this.$data.comFormData.allocationOrder.depositMoney = this.$data.multipleSelections[0].depositMoney;
					this.$data.comFormData.allocationOrder.depositRatio = this.$data.multipleSelections[0].depositRatio;
					
					//this.$data.comFormData.allocationOrder. = this.$data.multipleSelections[0];
					debugger;
					this.$http.get(this.API_ROOT + '/scm/allocationOrder/carList', {
						params: {
							id: this.$data.multipleSelections[0].id
						}
					}).then(resp => {
						debugger;
						this.$data.comFormData.allocationOrderDetailList = resp.data.data;
					}, resp => {});
					//this.$data.comFormData.allocationOrder = Object.assign(this.$data.comFormData.allocationOrder, this.$data.emptyData.allocationOrder);
					//this.$data.comFormData.allocationOrderDetailList = [];
					this.$data.comFormShow = true;
				} else {
					this.$message.error("请选择一条未提交数据！");
				}
			},
			//是否在售状态转换
			saleStatusCov: function(row, column) {
				
				return this.$data.tranTypeConvertData[row.allocationType];

			},
			addCar: function() {
				//				this.$data.comFormDatas = Object.assign(this.$data.comFormDatas, this.$data.emptyDatas);
				//				this.$data.comFormDatas.companyId = this.$data.conditions.companyId
				//this.$data.conditionCar.warehouse = this.$data.warehouseType[0].value;
				//this.$data.conditionCar 
				this.carQuery();
				this.$data.comFormShows = true;
			},
			//启用车系
			startCom: function() {
				if(this.$data.multipleSelection.length == 1) {
					debugger;
					var resRoleData = this.$data.multipleSelection[0];
					this.$http({
						method: 'POST',
						url: this.API_ROOT + '/insurance/start',
						params: {
							id: resRoleData.id,
						}
					}).then(function(resp) {
						debugger;
						this.companyQuery();
					}, function(error) {})
				} else {
					this.$message.error("请选择一条数据");
				}
			},
			//停用车系
			stopCom: function() {
				if(this.$data.multipleSelection.length == 1) {
					var resRoleData = this.$data.multipleSelection[0];
					this.$http({
						method: 'POST',
						url: this.API_ROOT + '/insurance/stop',
						params: {
							id: resRoleData.id,
						}
					}).then(function(resp) {
						this.companyQuery();
					}, function(error) {})
				} else {
					this.$message.error("请选择一条数据");
				}
			},
			//保存金额
			saveEditPrice: function() {
				debugger;
				this.$http.get(this.API_ROOT + '/scm/invoice/updateDetail', {
					params: {
						iid: this.$data.infoId,
						id: this.$data.comFormDataPrice.id,
						price: this.$data.comFormDataPrice.price
					}
				}).then((response) => {
					debugger;
					this.$message("保存成功");
					this.invoiceCarQuery();
				}, (response) => {});
				this.$data.editFormShow = false;
			},
			//查询调拨单列表
			companyQuery: function() {
				//debugger;
				//开始时间
				this.$data.condition.applicationStartDate = this.momentFu(this.$data.data.firstStart);
				//结束时间
				this.$data.condition.applicationStopDate = this.momentFu(this.$data.data.firstStarts);
				this.$data.conditions = {};
				this.$http.post(this.API_ROOT + '/scm/allocationOrder/page', this.$data.condition, {
					params: {
						start: this.$data.CurentPage,
						limit: this.$data.page.pageSize
					}
				}).then(resp => {
					if(resp.data.success) {
						resp.data.total = parseInt(resp.data.total);
						// es5写法
						this.$data.tableData = resp.data;
						//this.baseQuery(this.$data.curTreeDeptId);
						//this.$data.exFormShow = false;
					} else {
						//debugger;
						this.$message.error(resp.data.msg);
					}
				}, resp => {});
				debugger;
			},
			//时间判断为空的封装
			momentFu: function(dt) {
				if(dt == '' || dt == null || dt == undefined) {
					return "";
				} else {
					return this.moment(dt).format("YYYY-MM-DD");
				}
			},
			//查询选择的车辆
			carQuery: function() {
				this.$http.post(this.API_ROOT + '/scm/car/list', this.$data.conditionCar, {
					params: {
						//start: this.$data.CurentPageCar,
						//limit: this.$data.pageCar.pageSize
					}
				}).then(resp => {
					this.$data.tableDataCars.dataList = resp.data;
					this.$data.uName = this.$data.tableDataCars.dataList.uName;
				}, resp => {});
				debugger;
			},
			clean: function() {
				this.$data.conditionCar = Object.assign(this.$data.conditionCar, this.$data.conditionCars);
				this.$data.modelCombo = [];
				this.$data.configCombo = [];
				this.$data.carModelCode = "";
			},
			//查询调拨的车辆
			invoiceCarQuery: function() {

				this.$http.get(this.API_ROOT + '/scm/invoice/listDetail', {
					params: {
						id: this.$data.infoId
					}
				}).then(resp => {
					this.$data.comFormData.allocationOrderDetailList = resp.data;
				}, resp => {});
				debugger;
			},
			//查看详情 //操作右侧按钮明细
			info: function(index) {
				this.$data.prientShow = false; // 打印按钮默认不显示
				//this.$data.prientShow = true; // 测试显示
				debugger;
				this.$data.orderList = this.$data.tableData.dataList[index];
				if(this.$data.orderList.currentApprovalStatus == "结束") {
					this.$data.prientShow = true; // 显示打印按钮
				};

				//this.$data.prientShow = true; // 测试	先显现按钮
				this.$data.OallocationType = this.saleStatusCov(this.$data.orderList);
				this.$data.OOutWhere = this.fromWarehouseCov(this.$data.orderList);
				this.$data.OrecieveWhere = this.aimWarehouseCov(this.$data.orderList);
				//调拨单ID
				this.$data.sele.allocationId = this.$data.orderList.id;

				debugger;
				this.$http.get(this.API_ROOT + '/scm/allocationOrder/carList', {
					params: {
						id: this.$data.tableData.dataList[index].id
					}
				}).then(resp => {
					debugger;
					this.$data.editComFormShow = true;
					this.$data.comFormData.allocationOrderDetailList = resp.data.data;
				}, resp => {});
				//this.$message("已生成出库单");
			},
			//查看调拨审批详情
			infos: function(index) {
				this.$data.orderList = this.$data.tableData.dataList[index];
				this.$data.sele.allocationId = this.$data.orderList.id;
				this.$data.statsInfo = this.$data.orderList.currentApprovalStatus;

				this.$http.post(this.API_ROOT + '/scm/approvalflowDetail/page', this.$data.sele, {
					params: {}
				}).then(resp => {
					if(resp.data.success) {
						debugger;
						this.$data.sList = resp.data.dataList;
						this.$data.editComFormShowL = true;
						var li = this.$data.sList;
					} else {}
				}, resp => {})
				debugger;
				/*this.$data.orderList = this.$data.tableData.dataList[index];
				if(this.$data.orderList.currentApprovalStatus == "结束") {
					this.$data.prientShow = true;
				};
				this.$http.get(this.API_ROOT + '/scm/allocationOrder/carList', {
					params: {
						id: this.$data.tableData.dataList[index].id
					}
				}).then(resp => {
					debugger;
					this.$data.editComFormShowL = true;
					this.$data.privateList = resp.data.data;
				}, resp => {});*/
				//this.$message("已生成出库单");
			},
			redstats: function(row) {
				var temp = "";
				switch(row.approvalStatus) {
					case '0':
						temp = "通过";
						break;

					case '1':
						temp = "未通过";
						break;

					default:
						''
						break
				};
				return temp;
			},
			//保存
			save: function() {
				debugger;
				//调拨时间
				this.$data.comFormData.allocationOrder.allocationDate = this.momentFu(this.$data.comFormData.allocationOrder.allocationDate);
				//预计回库时间arriveWarehouseDate
				this.$data.comFormData.allocationOrder.arriveWarehouseDate = this.momentFu(this.$data.comFormData.allocationOrder.arriveWarehouseDate);
				//获取调拨数量
				this.$data.comFormData.allocationOrder.allocationNum = this.$data.comFormData.allocationOrderDetailList.length;
				this.$http.post(this.API_ROOT + '/scm/allocationOrder/save', this.$data.comFormData)
					.then(resp => {
						if(resp.data.success) {
							debugger;
							this.companyQuery();
							this.$data.comFormShow = false;
							this.$message(resp.data.msg);
						} else {
							this.$message.error(resp.data.msg);
						}
					}, resp => {});
			},
			//保存调拨单
			saveOrder: function() {
				debugger;
				this.$http.post(this.API_ROOT + '/scm/invoice/saveInvoiceDetail', this.$data.multipleSelection, {
						params: {
							id: this.$data.infoId
						}
					})
					.then(resp => {
						if(resp.data.success) {
							debugger;
							this.invoiceCarQuery();
							this.$data.comFormShows = false;
						} else {
							this.$message.error(resp.data.msg);
						}
					}, resp => {});
			},
			//列表，分页大小切换
			handleSizeChange: function() {},
			//列表,当前页切换
			handleCurrentChange: function(currentPage) {
				this.$data.CurentPage = currentPage;
				//this.$data.dictGroup = '';
				this.companyQuery();
			},
			//列表，分页大小切换
			handleSizeChangeCar: function() {},
			//列表,当前页切换
			handleCurrentChangeCar: function(currentPage) {
				this.$data.CurentPageCar = currentPage;
				//this.$data.dictGroup = '';
				this.carQuery();
			},
			//发出仓库代码与名称转换
			fromWarehouseCov: function(row, column) {
				return this.$data.levelConvertData[row.fromWarehouse];
			},
			//接收仓库代码与名称转换
			aimWarehouseCov: function(row, column) {
				return this.$data.levelConvertData[row.aimWarehouse];
			},
			//仓库转换转换
			warehouseCovert: function() {
				this.$http.get(this.API_ROOT + '/scm/warehouse/convert', {
					params: {}
				}).then((response) => {
					this.$data.levelConvertData = response.data;
				}, (response) => {});
			},
			//调拨类型转换
			transferTypeCovert: function() {
				this.$http.get(this.API_ROOT + '/base/dict/convert', {
					params: {
						group: "transferType"
					}
				}).then((response) => {
					this.$data.tranTypeConvertData = response.data;
				}, (response) => {});
			},
		},
		//表单创建时执行
		created: function() {

			this.companyQuery();
			this.transferTypeCovert();
			this.warehouseCovert();
			//获取仓库的下拉
			this.$http.get(this.API_ROOT + '/scm/warehouse/combo', {
				params: {

				}
			}).then((response) => {
				this.$data.warehouseCombo = response.data;
			}, (response) => {});
			//仓库下拉
			this.$http.get(this.API_ROOT + '/scm/warehouse/combo', {
				params: {
					group: "warehouse"
				}
			}).then((response) => {
				this.$data.warehouseType = response.data;
			}, (response) => {});
			//获取审批流类型下拉
			this.$http.get(this.API_ROOT + '/base/dict/combo', {
				params: {
					group: "transferType"
				}
			}).then((response) => {
				this.$data.transferTypeCombo = response.data;
			}, (response) => {});
		}
	}
</script>
<style>
	.el-table .info-row {
		height: 10px !important;
	}
	
	.item {
		width: 30px;
	}
	
	.el-form-item {
		clear: both;
	}
	
	.el-dropdown .el-button-group,
	.el-table .el-tooltip,
	.el-table .el-tooltip__rel {
		display: inline;
	}
	
	.el-table {
		height: 100%;
		width: 100%;
	}
	
	#el-select {
		width: 200px;
	}
	
	.box-card-f {
		width: 100%;
		height: 260px;
		margin-top: 20px;
		margin-bottom: 20px;
	}
</style>